/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.company.builders;

import com.company.primitivies.Curve;
import com.company.primitivies.Point2d;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author admin
 */
public class BuilderCurve {

    private Curve curve;

    public BuilderCurve(Curve curve) {
        this.curve = curve;
    }

    public List<Point2d> posCase(double h) {
        List<Point2d> result = new ArrayList<>();
        double t = -curve.getC() + 0.01;
        while (t < curve.getC()) {
            result.add(new Point2d(curve.genXpos(t), curve.genYpos(t)));
            t = t + h;
        }
        return result;
    }

    public List<Point2d> negCase(double h) {
        List<Point2d> result = new ArrayList<>();
        double t = -curve.getC() + 0.01;
        while (t < curve.getC()) {
            result.add(new Point2d(curve.genXneg(t), curve.genYneg(t)));
            t = t + h;
        }
        return result;
    }

    public List<Point2d> fullCase(double h) {
        List<Point2d> result = new ArrayList<>();
        double t = -curve.getC();
        while (t <= curve.getC()) {
            result.add(new Point2d(curve.genXpos(t), curve.genYpos(t)));
           
            t = t + h;
        }
        t = curve.getC();
        while (t >= -curve.getC()){
           
            result.add(new Point2d(curve.genXneg(t), -curve.genYneg(t)));
            t = t - h;
        }
        return result;
    }

}
